const config = require("../constant/constant")

function axios(url, method, data) {
    return new Promise(function (resolve, reject) {
        wx.request({
            url: config.baseUrl + url,
            method: method,
            data: method === "POST" ? JSON.stringify(data) : data,
            success: (res) => {
                resolve(res.data)
            },
            fail: (err)=> {
                reject(err)
            }
        })
    })
}
module.exports = axios